#import "dfhgwhruebvhrheythrivealternate.h"
@implementation dfhgwhruebvhrheythrivealternate {
    UILabel *leftText;
    UIView *leftView;
    UIView *rightView;
    UITextField *textField;
}
- (instancetype)init {
    if ([super init]) {
        [self configUI];
    }
    return self;
}
- (void)setContent:(NSString *)content {
    _content = content;
    textField.text = content;
}
- (void)setPlaceholder:(NSString *)placeholder {
    NSMutableAttributedString *phoneAttr = [[NSMutableAttributedString alloc] initWithString:placeholder];
    [phoneAttr addAttributes:@{NSForegroundColorAttributeName:[text_color3 dhgfywegwygeydwlearneddesignate], NSFontAttributeName:[UIFont regular:15]} range:NSMakeRange(0, phoneAttr.length)];
    textField.attributedPlaceholder = phoneAttr;
}
- (void)setSecureTextEntry:(BOOL)secureTextEntry {
    _secureTextEntry = secureTextEntry;
    textField.secureTextEntry = secureTextEntry;
}
- (void)setCanEdit:(BOOL)canEdit {
    _canEdit = canEdit;
    textField.enabled = canEdit;
    if (canEdit) {
        textField.textColor = text_color1.dhgfywegwygeydwlearneddesignate;
    }else {
        textField.textColor = text_color4.dhgfywegwygeydwlearneddesignate;
    }
}
- (void)configUI {
    self.layer.borderWidth = 1;
    self.layer.cornerRadius = 12;
    self.layer.borderColor = text_color3.dhgfywegwygeydwlearneddesignate.CGColor;
    leftView = [[UIView alloc] init];
    rightView = [[UIView alloc] init];
    leftText = [[UILabel alloc] init];
    leftText.font = [UIFont regular:16];
    leftText.textAlignment = NSTextAlignmentCenter;
    leftText.textColor = text_color1.dhgfywegwygeydwlearneddesignate;
    [leftView addSubview:leftText];
    textField = [[UITextField alloc] init];
    textField.leftView = leftView;
    textField.keyboardType = UIKeyboardTypeNumberPad;
    textField.leftViewMode = UITextFieldViewModeAlways;
    [self addSubview:textField];
}
- (void)layoutSubviews {
    [super layoutSubviews];
    textField.frame = self.bounds;
    if (self.left_text.length) {
        leftText.text = self.left_text;
        leftView.frame = CGRectMake(0, 0, 55, textField.bounds.size.height);
        leftText.frame = leftView.bounds;
    }else {
        leftView.frame = CGRectMake(0, 0, 12, textField.bounds.size.height);
    }
    if (self.rightBtn == nil) {
        textField.php_w -= 10;
        rightView.frame = CGRectZero;
        textField.clearButtonMode = UITextFieldViewModeWhileEditing;
    }else {
        [self.rightBtn removeFromSuperview];
        CGFloat btn_w = self.rightBtn.bounds.size.width + 24;
        rightView.frame = CGRectMake(0, 0, btn_w, textField.bounds.size.height);
        self.rightBtn.center = rightView.center;
        [rightView addSubview:self.rightBtn];
        textField.rightView = rightView;
        textField.rightViewMode = UITextFieldViewModeAlways;
    }
}
@end
